<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

</head>
<body>
    <div id="app">
        <form method="post">
            username : <input type="text" v-model="user.username" />  <p />

            password : <input type="password" v-model="user.password" /> <p />

            <input type="button" value="登 录"  @click="login"/>
        </form>
    </div>

    <script>
        let vueApp = new Vue({
            el:"#app",
            data:{
                user:{
                    username:'',
                    password:''
                }
            },
            methods:{
                login(){
                    let  url = "http://localhost:40000/manager/user/login" ;
                    axios.post(url,this.user).then((res)=>{
                        console.log(res);
                        if (res.data.code == 200) {
                            //alert(res.data.message);
                            location.href = "/goods.html";
                        }else {
                            alert(res.data.message);
                        }
                    });
                }
            }
        });
    </script>
</body>
</html>